﻿using System;
using System.Data;

namespace Smatime.Web.Models
{
    public class HistoryOfUser : BaseEntity
    {
        public string Email { get; set; }
        public long CompanyId { get; set; }
        public string TotalWork { get; set; }
        public string Name { get; set; }
        public string UserAccessId { get; set; }
        public DateTime? LoginTime { get; set; }
        public DateTime? LogoutTime { get; set; }
        public string SourceIp { get; set; }
        public string HostName { get; set; }
        public string Content { get; set; }
        public string EditTarget { get; set; }
        public string EditContent { get; set; }
        public string BeforeEdit { get; set; }
        public string AfterEdit { get; set; }

        public override BaseEntity FromDataRow(DataRow row)
        {
            Id = (long) row["Id"];
            CompanyId = (long) row["CompanyId"];
            TotalWork = row["TotalWork"].ToString();
            UserAccessId = row["UserAccessId"].ToString();
            Email = row["Email"].ToString();
            Name = row["Name"].ToString();
            LoginTime = row["LoginTime"].ToDateTime();
            LogoutTime = row["LogoutTime"].ToDateTime();
            SourceIp = row["SourceIp"].ToString();
            HostName = row["HostName"].ToString();
            Content = row["Content"].ToString();
            EditTarget = row["EditTarget"].ToString();
            EditContent = row["EditContent"].ToString();
            BeforeEdit = row["BeforeEdit"].ToString();
            AfterEdit = row["AfterEdit"].ToString();
            return base.FromDataRow(row);
        }
    }
}